% color1 = ['b','g','r','c','m','y','k','b'];
figure('Position',[1 250 800 300]);
color1 = [154.0254  157.0244 158.0245  159.0244  159.6244 160.2245 161.0245  161.7245  162.0245  163.0245  ];
subplot(1,3,1);
axis([-1,1,-1,1]); hold on; 
for degree = 3:12   
    v_idx = find(d(1:posT)==degree);
    n = length(v_idx);
    if n>0
        TRI=zeros(n,6);
        for i=1:n
            TRI(i,:)=[V(T(v_idx(i),1),:),V(T(v_idx(i),2),:),V(T(v_idx(i),3),:)];
        end;
        x=TRI(:,1:2:5); y=TRI(:,2:2:6);    
        X=[x,x(:,1)]';  Y=[y,y(:,1)]';
        fill(X,Y,color1(degree-2));
    end
end
hold off;

% a bigger view
subplot(1,3,2);
axis([-0.5, 0.5, -0.5, 0.5]); hold on; 
hands = []; strs = [];
for degree = 3:12   
    v_idx = find(d(1:posT)==degree);
    n = length(v_idx);
    if n>0
        TRI=zeros(n,6);
        for i=1:n
            TRI(i,:)=[V(T(v_idx(i),1),:),V(T(v_idx(i),2),:),V(T(v_idx(i),3),:)];
        end;
        x=TRI(:,1:2:5); y=TRI(:,2:2:6);    
        X=[x,x(:,1)]';  Y=[y,y(:,1)]';
        b = fill(X,Y,color1(degree-2));
        hands = [hands;b(1)];
        if degree<10
            strs = [strs;strcat(' d=',num2str(degree))];
        else
            strs = [strs;strcat('d=',num2str(degree))];
        end
    end
end
hold off;

% a magnify viewer
subplot(1,3,3);
axis([-0.25, 0.25, -0.25, 0.25]); hold on; 
for degree = 3:12   
    v_idx = find(d(1:posT)==degree);
    n = length(v_idx);
    if n>0
        TRI=zeros(n,6);
        for i=1:n
            TRI(i,:)=[V(T(v_idx(i),1),:),V(T(v_idx(i),2),:),V(T(v_idx(i),3),:)];
        end;
        x=TRI(:,1:2:5); y=TRI(:,2:2:6);    
        X=[x,x(:,1)]';  Y=[y,y(:,1)]';
        b = fill(X,Y,color1(degree-2));
    end
end
hold off;

legend(hands,strs,'Location','SouthOutside','Orientation','horizontal');    